<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>请确认你的注册信息</title>
    <link rel="shortcut icon" th:href="@{/favicon.ico}" />
    <link rel="bookmark" th:href="@{/favicon.ico}"/>
    <style>
        @media screen and (min-width: 800px) {
            .box {
                width: 360px;
            }
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body style="">
<div class="box" style="margin: 0 auto; border: 1px solid #3d484c;">
    <nav style="background-color: #3d484c;height: 45px;">
        <div style="float: right;color: #ffffff;padding: 12px">寻医路</div>
    </nav>
    <div style="padding: 0 8px;">
        <h3 style="margin: 15px 2px;" id="test">
            尊敬的 <span style="color: #31bdeb;" id="name"></span>
        </h3>
        <p style="margin: 15px 2px;">
            <h3 id="info"></h3>
        </p>
        <h4 style="margin: 15px 2px;">创客实验室 团队</h4>
    </div>
    <footer style="height: 5px;background-color: #3d484c;"></footer>
</div>
</body>
<script>
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
    $(function () {
        var s = getUrlParam('s');
        var t = getUrlParam('t');
        var code = getUrlParam('code');

        $.post('http://' + window.location.host + '/email/check', {"s": s, "t": t, "code": code}, function (result) {
            if (result.status === 200 && result.success === true) {
                $('#name').html(result.payload.name)
                $('#info').html('恭喜你注册成功,现在可以使用寻医路啦!')
            } else {
                $("#test").hide()
                $('#info').html(result.msg)
            }
        })
    })
</script>
</html>